﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AMS.Core.Services;
using AMS.Core.Data;
using System.Security.Authentication;

namespace AMS.DD35.ServiceLib.Tests
{
    class MockLoginService : ILoginService
    {
        ISessionService _session;

        public MockLoginService(ISessionService session)
        {
            _session = session;
        }

        public ISessionService SessionService
        {
            get { return _session; }
        }

        public object AttemptLogin(LoginData loginData)
        {
            if (loginData.Username == "validUsername" &&
                loginData.PasswordHash == "validHash")
                return "validSession";
            else
                throw new AuthenticationException("invalid credentials");
        }

        public void Logout(object sessionVariable)
        {
            _session.EndSession(sessionVariable);
        }
    }
}
